<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div>
      <h1>减少数据读取次数</h1>
      <p>栈区的数据访问较快</p>
      <p>堆区的数据访问较慢,因为需要按照引用的关系找到对应的位置</p>
    </div>
    <div id="skip" class="skip"></div>
    <script>
      var oBox = document.getElementById("skip");
      function hasEle(ele, cls) {
        return ele.className == cls;
      }

      //优化
      function hasEle(ele, cls) {
        var clsname = ele.className;
        return clsname == cls;
      }
      console.log(hasEle(oBox, "skip"));
    </script>
  </body>
</html>
